package director;

import behavior.chain_responsibility.*;

public class ChainResponsibilityDirector {

    public static void main(String[] args){
        ChainHandler handler1 = new DebugHandler();
        ChainHandler handler2 = new InfoHandler();
        ChainHandler handler3 = new WarningHandler();
        //组装一个责任链
        handler1.next(handler2).next(handler3);
        Request r1 = new Request(1);
        Request r2 = new Request(3);
        Request r3 = new Request(4);
        handler1.handle(r1);
        handler1.handle(r2);
        handler1.handle(r3);
    }
}
